function fun_ecmms_detailtext(i){//取出数据区域文本
    var s =$("#ecmmsMake_detailtext_" + i).html();
    var r ='<a xmlns="http://www.w3.org/1999/xhtml">';
    if(s.indexOf(r)==0){
        s =s.substring(r.length,s.length-4)
    }
    if(s.length>40){
        $("#ecmmsMake_detailtext_" + i).html(ecmmsMake_tabRowArry[i].textString.substring(0,40).replaceAll("\n", "<br>"));
    }else{
        $("#ecmmsMake_detailtext_" + i).html(ecmmsMake_tabRowArry[i].textString.replaceAll("\n", "<br>"));
    }
}

function fun_ecmmsMake_tabHml(){//帧列表添加帧
	return "<tr id='ecmmsFrame_zs_make"+ecmmsmake.sort+"' class=''><td width='50%' valign='top' class='preview'><div id='ecmms_make_tber_"+ecmmsmake.sort+"' class=''></div><div id='ecmms_make_img"+ecmmsmake.sort+"' class='imgs'><img id='ecmms_make_img_"+ecmmsmake.sort+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='ecmms_make_ring_"+ecmmsmake.sort+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='ecmms_make_text_"+ecmmsmake.sort+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='ecmms_make_ms_"+ecmmsmake.sort+"' class='second cl'>0 秒</p><p id='ecmms_make_del_"+ecmmsmake.sort+"' class=''></p></a></td></tr>"
            +"<tr id='ecmmsFrame_zs_make"+(ecmmsmake.sort+1)+"' class=''><td width='50%' valign='top' class='preview'><div id='ecmms_make_tber_"+(ecmmsmake.sort+1)+"' class=''></div><div id='ecmms_make_img"+(ecmmsmake.sort+1)+"' class='imgs'><img id='ecmms_make_img_"+(ecmmsmake.sort+1)+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='ecmms_make_ring_"+(ecmmsmake.sort+1)+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='ecmms_make_text_"+(ecmmsmake.sort+1)+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='ecmms_make_ms_"+(ecmmsmake.sort+1)+"' class='second cl'>0 秒</p><p id='ecmms_make_del_"+(ecmmsmake.sort+1)+"' class=''></td></tr>"
            +"<tr id='ecmmsFrame_zs_make"+(ecmmsmake.sort+2)+"' class=''><td width='50%' valign='top' class='preview'><div id='ecmms_make_tber_"+(ecmmsmake.sort+2)+"' class=''></div><div id='ecmms_make_img"+(ecmmsmake.sort+2)+"' class='imgs'><img id='ecmms_make_img_"+(ecmmsmake.sort+2)+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='ecmms_make_ring_"+(ecmmsmake.sort+2)+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='ecmms_make_text_"+(ecmmsmake.sort+2)+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='ecmms_make_ms_"+(ecmmsmake.sort+2)+"' class='second cl'>0 秒</p><p id='ecmms_make_del_"+(ecmmsmake.sort+2)+"' class=''></td></tr>"
            +"<tr id='ecmmsFrame_zs_make"+(ecmmsmake.sort+3)+"' class=''><td width='50%' valign='top' class='preview'><div id='ecmms_make_tber_"+(ecmmsmake.sort+3)+"' class=''></div><div id='ecmms_make_img"+(ecmmsmake.sort+3)+"' class='imgs'><img id='ecmms_make_img_"+(ecmmsmake.sort+3)+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='ecmms_make_ring_"+(ecmmsmake.sort+3)+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='ecmms_make_text_"+(ecmmsmake.sort+3)+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='ecmms_make_ms_"+(ecmmsmake.sort+3)+"' class='second cl'>0 秒</p><p id='ecmms_make_del_"+(ecmmsmake.sort+3)+"' class=''></td></tr>"
}

function ecmms_make_downdata(){//帧列表下拉
	mmsMakeDowndata(ecmmsmake,"ecmmsFrame_zs_make");
}

function ecmms_make_updata(){//帧列表上拉
	mmsMakeUpdata(ecmmsmake,"ecmmsFrame_zs_make");
}

function fun_ecmmsimage_loadcheck(e,i){//本地资源选中图片时
	var picId =$("#ecmms_ick_load_"+i+"_id").val();
	var picName =$("#ecmms_ick_load_"+i+"_fileName").val();
    var picSize =$("#ecmms_ick_load_"+i+"_fileLen").val();
    var picPath =$("#ecmms_ick_load_"+i+"_filePath").val();
    var picType =$("#ecmms_ick_load_"+i+"_fileSuf").val();
    if(e.checked){//选中
        if($("#ecmms_zimg_make").attr("alt")=="t"){
            alertmsg("同一帧不能插入两张图片!","alert");
            e.checked=false;
            return false;
        }
        if(ecmmsmake.sortsourceIds.length==0){//存储稿件源
            ecmmsmake.sortsourceIds=e.id;
        }else{
            ecmmsmake.sortsourceIds+=","+e.id;
        }
        $("#ecmms_zimg_make").attr("src",mDiv.remotehostipport+picPath);
        $("#ecmms_zimg_make").attr("alt","t");
        //fun_mms_zsize(ecmmsmake,picSize);
        ecmmsmake.mmssize += parseInt(picSize);
        $("#ecmms_zsize_make").html("快讯大小： "+ecmmsmake.mmssize+"KB/ "+ecmmsmake.mmsallsize+"KB ");
        ecmmsmake.picName = picName; 
        ecmmsmake.picSize = picSize; 
        ecmmsmake.picType = picType; 
        ecmmsmake.picPath = picPath; 
        ecmmsmake.picsoId = picId; 
    }else{
        var ssarr =ecmmsmake.sortsourceIds.split(",");
    	var ssarrlength =ssarr.length;
    	var newssarr =new Array();
    	var isfalse =false;
    	for(var k=0;k<ssarrlength;k++){
	        if(ssarr[k] == e.id) {
	        	isfalse =true;
	        }else{
	            newssarr.push(ssarr[k]);
	        }
	    }
        if(isfalse){
             $("#ecmms_zimg_make").attr("src","images/tmp.jpg");
             $("#ecmms_zimg_make").attr("alt","f");
             ecmmsmake.mmssize += parseInt(-picSize);
             $("#ecmms_zsize_make").html("快讯大小： "+ecmmsmake.mmssize+"KB/ "+ecmmsmake.mmsallsize+"KB ");
             ecmmsmake.picName = ""; 
             ecmmsmake.picSize = ""; 
             ecmmsmake.picType = ""; 
             ecmmsmake.picPath = ""; 
             ecmmsmake.picsoId = ""; 
             ecmmsmake.sortsourceIds =newssarr.join();//新的复选框源
        }
    }
}

function fun_ecmmsring_loadcheck(e,i){//本地资源选中铃声时
	var ringId =$("#ecmms_rck_load_"+i+"_id").val();
    var ringName =$("#ecmms_rck_load_"+i+"_fileName").val();
    var ringSize =$("#ecmms_rck_load_"+i+"_fileLen").val();
    var ringPath =$("#ecmms_rck_load_"+i+"_filePath").val();
    var ringUrl =$("#ecmms_rck_load_"+i+"_fileUrl").val().replaceAll("&amp;", "&");
    var ringType =$("#ecmms_rck_load_"+i+"_fileSuf").val();
    
    if(e.checked){//选中
        if($("#ecmms_ring_make").html().length>0){
            alertmsg("同一帧不能插入两个铃声!","alert");
            e.checked=false;
            return false;
        }  
        if(ecmmsmake.sortsourceIds.length==0){
            ecmmsmake.sortsourceIds=e.id;
        }else{
            ecmmsmake.sortsourceIds+=","+e.id;
        }
        $("#ecmms_ring_make").html("铃声：<a href='"+ringUrl+"'>"+ringName+"</a>");
        $("#ecmms_rv_make").show();

        ecmmsmake.mmssize += parseInt(ringSize);
        $("#ecmms_zsize_make").html("快讯大小： "+ecmmsmake.mmssize+"KB/ "+ecmmsmake.mmsallsize+"KB ");
        ecmmsmake.ringName = ringName;
        ecmmsmake.ringSize = ringSize;
        ecmmsmake.ringType = ringType;
        ecmmsmake.ringPath = ringPath;
        ecmmsmake.ringDownload ="";
        ecmmsmake.ringsoId = ringId; 

    }else{
    	var ssarr =ecmmsmake.sortsourceIds.split(",");
    	var ssarrlength =ssarr.length;
    	var newssarr =new Array();
    	var isfalse =false;
    	for(var k=0;k<ssarrlength;k++){
	        if(ssarr[k] == e.id) {
	        	isfalse =true;
	        }else{
	            newssarr.push(ssarr[k]);
	        }
	    }
        if(isfalse){
             $("#ecmms_ring_make").html("");
             $("#ecmms_rv_make").hide();
             ecmmsmake.mmssize += parseInt(-ringSize);
             $("#ecmms_zsize_make").html("快讯大小： "+ecmmsmake.mmssize+"KB/ "+ecmmsmake.mmsallsize+"KB ");
             ecmmsmake.ringName = ""; 
             ecmmsmake.ringSize = ""; 
             ecmmsmake.ringType = ""; 
             ecmmsmake.ringPath = ""; 
             ecmmsmake.ringDownload ="";
             ecmmsmake.ringsoId = "";

             ecmmsmake.sortsourceIds =newssarr.join();
        }
    }

}

function fun_ecmms_arry(){
    var sortlength =ecmmsMake_sortsize.length;
	var newsortarr =new Array();
	for(var i=0;i<sortlength;i++){
		if(i<(ecmmsmake.sort-1)){
		    newsortarr.push(ecmmsMake_sortsize[i]);
		}else if(i==(ecmmsmake.sort-1)){
	        newsortarr.push(ecmmsmake.mmssize);
	    }else{
	        newsortarr.push(ecmmsMake_sortsize[i-1]);
	    }
	}
	newsortarr.push(ecmmsMake_sortsize[sortlength-1]);
	ecmmsMake_sortsize =newsortarr;

	var sIdlength =ecmmsMake_sortsourceId.length;
	var newsIdarr =new Array();
	for(var i=0;i<sIdlength;i++){
	    if(i<(ecmmsmake.sort-1)){
		    newsIdarr.push(ecmmsMake_sortsourceId[i]);
		}else if(i==(ecmmsmake.sort-1)){
			newsIdarr.push(ecmmsmake.sortsourceIds);
	    }else{
	        newsIdarr.push(ecmmsMake_sortsourceId[i-1]);
	    }
	}
	newsIdarr.push(ecmmsMake_sortsourceId[sIdlength-1]);
	ecmmsMake_sortsourceId =newsIdarr;
}

function fun_ecmmsMake_textsize() {//修改帧大小及字数

    ecmmsmake.textContent =$("#ecmms_textString_make").val();
    var bs =getBytesCount(ecmmsmake.textContent);//文本字节大小
    var zs =ecmmsmake.textContent.length//文本字数
    var picsize =0,ringsize =0;
    bs =fSizeJs(bs);
    ecmmsmake.textContentSize =bs;
    $("#ecmms_wbzs_make").html("备注：当前文本字数 "+zs);
    if(zs>800){
          $("#ecmms_wbzs_make").attr("class","redcolor");
    }else{
         $("#ecmms_wbzs_make").attr("class","");
    }
    if(ecmmsmake.picSize.length>0){
        picsize= parseInt(ecmmsmake.picSize);
    }
    if(ecmmsmake.ringSize.length>0){
        ringsize= parseInt(ecmmsmake.ringSize);
    }
    bs +=picsize+ringsize;
    ecmmsmake.mmssize =bs;
    /**
    if(ecmmsmake.insert>-1){
        ecmmsmake.mmsallsize =ecmmsmake.mmsallsize+bs;
        var sortlength =ecmmsMake_sortsize.length;
		var newsortarr =new Array();
		for(var i=0;i<sortlength;i++){//取出帧大小放入新的数组
			if(i<(ecmmsmake.sort-1)){
			    newsortarr.push(ecmmsMake_sortsize[i]);
			}else if(i==(ecmmsmake.sort-1)){
		        newsortarr.push(bs);
		    }else{
		        newsortarr.push(ecmmsMake_sortsize[i-1]);
		    }
		}
		newsortarr.push(ecmmsMake_sortsize[sortlength-1]);
		ecmmsMake_sortsize =newsortarr;

		var sIdlength =ecmmsMake_sortsourceId.length;
		var newsIdarr =new Array();
		for(var i=0;i<sIdlength;i++){//每帧复选框源放入新的数组
		    if(i!=(ecmmsmake.sort-1)){
		        newsIdarr.push(ecmmsMake_sortsourceId[i]);
		    }
		    if(i<(ecmmsmake.sort-1)){
			    newsIdarr.push(ecmmsMake_sortsourceId[i]);
			}else if(i==(ecmmsmake.sort-1)){
		        newsortarr.push(ecmmsmake.sortsourceIds);
		    }else{
		        newsIdarr.push(ecmmsMake_sortsourceId[i-1]);
		    }
		}
		newsIdarr.push(ecmmsMake_sortsourceId[sIdlength-1]);
		ecmmsMake_sortsourceId =newsIdarr;

    }else if(ecmmsmake.update>-1){
    	if(ecmmsmake.lastsize==0){
    		if(bs>0){
    		    ecmmsmake.mmsallsize =ecmmsmake.mmsallsize+bs-ecmmsMake_sortsize[ecmmsmake.sort-1];
    		}
    	}else{
    		if(bs>0){
    		    ecmmsmake.mmsallsize =ecmmsmake.mmsallsize+bs-ecmmsmake.lastsize;
    		}
    	}
    }else{
    	if(ecmmsmake.lastsize==0){
    		ecmmsmake.mmsallsize =ecmmsmake.mmsallsize+bs-picsize-ringsize;
    	}else{
    	    ecmmsmake.mmsallsize =ecmmsmake.mmsallsize+bs-ecmmsmake.lastsize;
    	}
    }
    ecmmsmake.lastsize =bs;
    **/
    $("#ecmms_zsize_make").html("快讯大小： "+ecmmsmake.mmssize+"KB/ "+ecmmsmake.mmsallsize+"KB ");
}

function fun_ecmmsMake_Chackdata() {//新增修改帧验证数据
	var ms = $("#ecmms_make_zhems").val();
	var ring = $("#ecmms_ring_make").html();
	var imgalt = $("#ecmms_zimg_make").attr("alt");
	var textstr = $("#ecmms_textString_make").val();
	if (ms.length == 0) {
		alertmsg(" '秒数'不能为空!", "alert");
		return false;
	} else {
		if (Number(ms) > 999) {
			alertmsg(" '秒数'最大不能超过999秒!", "alert");
			return false;
		} else {
			if (ring.length == 0 && imgalt == "f" && textstr.length == 0) {
				alertmsg("不能加入空白帧到帧列表!", "alert");
				return false;
			}
		}
	}
	
	if (!checkCharText(textstr)){
		 return false;
	}
	ecmmsmake.playTime =ms;
	return true;
}


function fun_ecmmsMake_saveZhen() {//新增保存帧
	var mmsSubObj = new fun_ecmmsMake_subObj(ecmmsmake);
	mmsSubObj.playTime = ecmmsmake.playTime;
	mmsSubObj.sort = ecmmsmake.sort;
	mmsSubObj.textContent = ecmmsmake.textContent; 
	mmsSubObj.textContentSize = ecmmsmake.textContentSize; 

	mmsSubObj.picName = ecmmsmake.picName; 
	mmsSubObj.picSize = ecmmsmake.picSize; 
	mmsSubObj.picType = ecmmsmake.picType; 
	mmsSubObj.picPath = ecmmsmake.picPath; 
	mmsSubObj.picsoId = ecmmsmake.picsoId; 
	mmsSubObj.ringName = ecmmsmake.ringName;
	mmsSubObj.ringSize = ecmmsmake.ringSize;
	mmsSubObj.ringType = ecmmsmake.ringType;
	mmsSubObj.ringPath = ecmmsmake.ringPath;
	mmsSubObj.ringsoId = ecmmsmake.ringsoId; 

	mmsSubObj.ringDownload = ecmmsmake.ringDownload; 
	ecmmsMainObj.addSubObj(mmsSubObj);
	ecmmsMake_sortsize[ecmmsmake.sort-1] =ecmmsmake.mmssize;
	ecmmsMake_sortsourceId[ecmmsmake.sort-1] =ecmmsmake.sortsourceIds;
}

function fun_ecmmsMake_saverefZhenList() {//新增刷新帧列表
	if(ecmmsmake.sort>ecmmsmake.pagezise&&ecmmsmake.sort%ecmmsmake.pagezise==1){
        ecmmsmake.pagecount++; 
	    $("#ecmmsFrame_zs_make").append(fun_ecmmsMake_tabHml());//添加帧列表数据
	    ecmms_make_downdata();//下拉一页
	}
	$("#ecmms_make_tber_"+ecmmsmake.sort).html(ecmmsmake.sort+"/"+ecmmsmake.allsort);//帧标题
	$("#ecmms_make_tber_"+ecmmsmake.sort).attr("class","frameNumber");
	$("#ecmms_make_ms_"+ecmmsmake.sort).html(ecmmsmake.playTime+" 秒");//秒数
	for(var i=ecmmsmake.sort-1;i<ecmmsmake.sort&&i>0;i--){//帽新帧标题
		var h =$("#ecmms_make_tber_"+i).html();
        h=h.substring(0,h.indexOf("/"));
	    $("#ecmms_make_tber_"+i).html(h+"/"+ecmmsmake.allsort);
	}
	if(ecmmsmake.textContent.length>0){//文字
	    $("#ecmms_make_text_"+ecmmsmake.sort).attr("class","ico-txt");
	}
	if($("#ecmms_zimg_make").attr("alt")=="t"){//图片
	    $("#ecmms_make_img_"+ecmmsmake.sort).attr("src",mDiv.remotehostipport+ecmmsmake.picPath);
	}
	if($("#ecmms_ring_make").html().length>0){//铃声
	    $("#ecmms_make_ring_"+ecmmsmake.sort).attr("class","ico-ring");
	}
	$("#ecmms_make_img"+ecmmsmake.sort).html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_loadOne("+ecmmsmake.sort+")'>"+$("#ecmms_make_img"+ecmmsmake.sort).html()+"</a>");

    if(ecmmsmake.sort>1){
    	$("#ecmms_make_del_"+ecmmsmake.allsort).attr("class","delframe");
        $("#ecmms_make_del_"+ecmmsmake.allsort).html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_delOne("+ecmmsmake.allsort+")'>删 除</a>");
    }
}

function fun_ecmmsMake_clearData(zhe) {//清空数据区域
    ecmmsmake.textContent="";
    ecmmsmake.textContentSize=0;

    ecmmsmake.playTime=10;
    ecmmsmake.mmssize=0;
    ecmmsmake.picName = ""; 
	ecmmsmake.picSize = ""; 
	ecmmsmake.picType = ""; 
	ecmmsmake.picPath = ""; 
	ecmmsmake.picsoId="";

	ecmmsmake.ringName = "";
	ecmmsmake.ringSize = "";
	ecmmsmake.ringType = "";
	ecmmsmake.ringPath = "";
	ecmmsmake.ringsoId ="";

	ecmmsmake.ringDownload ="";
	ecmmsmake.sortsourceIds="";
	ecmmsmake.lastsize=0;
	
	$("#ecmms_make_zhems").val(10);//秒数
	$("#ecmms_make_indexzs").html("当前帧：第 "+zhe+" 帧 时间");
	$("#ecmms_zimg_make").attr("src","images/tmp.jpg");//图片
    $("#ecmms_zimg_make").attr("alt","f");
    $("#ecmms_zsize_make").html("快讯大小： 0KB/ "+ecmmsmake.mmsallsize+"KB ");//大小
    $("#ecmms_textString_make").val("");//文字
    $("#ecmms_wbzs_make").html("备注：当前文本字数 0");
    $("#ecmms_wbzs_make").attr("class","");
    $("#ecmms_ring_make").html("");//铃声
    $("#ecmms_rv_make").hide();
}

function fun_ecmmsMake_loadOne(zhe){//修改加载数据
	if(ecmmsmake.insert>0){
		alertmsg("当前为插入帧状态 不能修改帧!","alert");
        return;
	}
    fun_ecmmsMake_clearData(zhe);
    ecmmsmake.update =zhe;
    $("#ecmmsFrame_zs_make").find("tr.current").attr("class","");
    $("#ecmmsFrame_zs_make"+zhe).attr("class","current");
    var subObj =ecmmsMainObj.getSubObj(zhe-1);
    ecmmsmake.playTime =subObj.playTime
    ecmmsmake.sort =zhe;
    $("#ecmms_make_zhems").val(subObj.playTime);
    
    if(subObj.picPath.length>0){
        $("#ecmms_zimg_make").attr("src",mDiv.remotehostipport+subObj.picPath);
        $("#ecmms_zimg_make").attr("alt","t");
        ecmmsmake.picName = subObj.picName; 
        ecmmsmake.picSize = subObj.picSize; 
        ecmmsmake.picType = subObj.picType; 
        ecmmsmake.picPath = subObj.picPath; 
        ecmmsmake.picsoId = subObj.picsoId; 
    }
    if(subObj.ringPath.length>0){
    	if(subObj.ringDownload.length>0){
    	    $("#ecmms_ring_make").html("铃声：<a href='"+subObj.ringDownload+"'>"+subObj.ringName+"</a>");
    	}else{
    	    $("#ecmms_ring_make").html("铃声："+subObj.ringName);
    	}
        $("#ecmms_rv_make").show();
        ecmmsmake.ringName = subObj.ringName;
        ecmmsmake.ringSize = subObj.ringSize;
        ecmmsmake.ringType = subObj.ringType;
        ecmmsmake.ringPath = subObj.ringPath;
        ecmmsmake.ringsoId = subObj.ringsoId; 

        ecmmsmake.ringDownload =subObj.ringDownload;
    }
    if(subObj.textContent.length>0){
        $("#ecmms_textString_make").val(subObj.textContent);
        var zs =subObj.textContent.length//文本字数
        $("#ecmms_wbzs_make").html("备注：当前文本字数 "+zs);
        if(zs>800){
              $("#ecmms_wbzs_make").attr("class","redcolor");
        }else{
             $("#ecmms_wbzs_make").attr("class","");
        }
        ecmmsmake.textContent =subObj.textContent;
        ecmmsmake.textContentSize=subObj.textContentSize;

    }
    ecmmsmake.mmssize =ecmmsMake_sortsize[zhe-1];
    ecmmsmake.upmmssize =ecmmsMake_sortsize[zhe-1];
    ecmmsmake.sortsourceIds =ecmmsMake_sortsourceId[zhe-1];
    
    var ssarr =ecmmsmake.sortsourceIds.split(",");
	var ssarrlength =ssarr.length;
	for(var k=0;k<ssarrlength;k++){
		if(ssarr[k].length>0){
		    $("#"+ssarr[k])[0].checked=true;
		}
    }
	
    $("#ecmms_zsize_make").html("快讯大小： "+ecmmsmake.mmssize+"KB/ "+ecmmsmake.mmsallsize+"KB ");
    $("#ecmms_make_addbtn").html("<img src='images/modifybtn.gif' width='65' height='23' border='0' onclick='fun_ecmms_upone("+zhe+")'>");
    if(zhe>1){
        $("#ecmms_insert_zhe").html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_insert("+zhe+")' class='insertFrame floatr'>插入帧</a>快讯帧列表");
    }
    
}

function fun_ecmmsMake_updateZhen(zhe) {//修改帧数据
	var mmsSubObj = new fun_ecmmsMake_subObj(ecmmsmake);
	//mmsSubObj.sourceId =mmsmake.sourceId;
	mmsSubObj.playTime = ecmmsmake.playTime;
	mmsSubObj.sort = ecmmsmake.sort;
	mmsSubObj.textContent = ecmmsmake.textContent; 
	mmsSubObj.textContentSize = ecmmsmake.textContentSize; 

	mmsSubObj.picName = ecmmsmake.picName; 
	mmsSubObj.picSize = ecmmsmake.picSize; 
	mmsSubObj.picType = ecmmsmake.picType; 
	mmsSubObj.picPath = ecmmsmake.picPath; 
	mmsSubObj.picsoId = ecmmsmake.picsoId; 
	mmsSubObj.ringName = ecmmsmake.ringName;
	mmsSubObj.ringSize = ecmmsmake.ringSize;
	mmsSubObj.ringType = ecmmsmake.ringType;
	mmsSubObj.ringPath = ecmmsmake.ringPath;
	mmsSubObj.ringsoId = ecmmsmake.ringsoId; 

	mmsSubObj.ringDownload = ecmmsmake.ringDownload;
	ecmmsMainObj.periodicalSubArr[zhe-1] =mmsSubObj;
	ecmmsMake_sortsize[ecmmsmake.sort-1] =ecmmsmake.mmssize;
	ecmmsMake_sortsourceId[ecmmsmake.sort-1] =ecmmsmake.sortsourceIds;
	ecmmsmake.sort=ecmmsmake.allsort+1;
}


function fun_ecmmsMake_uprefZhenList(zhe) {//修改刷新帧列表
	$("#ecmmsFrame_zs_make"+zhe).attr("class","");
	$("#ecmms_make_ms_"+zhe).html(ecmmsmake.playTime+" 秒");//秒数

	if(ecmmsmake.textContent.length>0){//文字
	    $("#ecmms_make_text_"+zhe).attr("class","ico-txt");
	}else{
	    $("#ecmms_make_text_"+zhe).attr("class","ico-txt-gray");
	}
	if($("#ecmms_zimg_make").attr("alt")=="t"){//图片
	    $("#ecmms_make_img_"+zhe).attr("src",mDiv.remotehostipport+ecmmsmake.picPath);
	}else{
	    $("#ecmms_make_img_"+zhe).attr("src","images/tmp.jpg");
	}
	if($("#ecmms_ring_make").html().length>0){//铃声
	    $("#ecmms_make_ring_"+zhe).attr("class","ico-ring");
	}else{
	    $("#ecmms_make_ring_"+zhe).attr("class","ico-ring-gray");
	}
	$("#ecmms_make_img"+zhe).html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_loadOne("+zhe+")'>"+$("#ecmms_make_img"+zhe).html()+"</a>");
	$("#ecmms_make_addbtn").html("<img src='images/addbtn.gif' width='65' height='23' border='0' onClick='fun_ecmms_addone()'>");
	$("#ecmms_insert_zhe").html("<a href='#' class='insertFrame-gray floatr'>插入帧</a>快讯帧列表");
}


function fun_ecmms_insertZhe(){
    var mmsSubObj = new fun_ecmmsMake_subObj(ecmmsmake);
	mmsSubObj.playTime = ecmmsmake.playTime;
	mmsSubObj.sort = ecmmsmake.sort;
	mmsSubObj.textContent = ecmmsmake.textContent; 
	mmsSubObj.textContentSize = ecmmsmake.textContentSize; 

	mmsSubObj.picName = ecmmsmake.picName; 
	mmsSubObj.picSize = ecmmsmake.picSize; 
	mmsSubObj.picType = ecmmsmake.picType; 
	mmsSubObj.picPath = ecmmsmake.picPath; 
	mmsSubObj.picsoId = ecmmsmake.picsoId; 

	mmsSubObj.ringName = ecmmsmake.ringName;
	mmsSubObj.ringSize = ecmmsmake.ringSize;
	mmsSubObj.ringType = ecmmsmake.ringType;
	mmsSubObj.ringPath = ecmmsmake.ringPath;
	mmsSubObj.ringsoId = ecmmsmake.ringsoId; 

	mmsSubObj.ringDownload = ecmmsmake.ringDownload; 
	ecmmsMainObj.insertSubObj(ecmmsmake.insert,mmsSubObj);
}

function fun_ecmmsMake_insertrefZhenList() {//新增刷新帧列表
	$("#ecmms_make_ms_"+ecmmsmake.sort).html(ecmmsmake.playTime+" 秒");//秒数
	if(ecmmsmake.textContent.length>0){//文字
	    $("#ecmms_make_text_"+ecmmsmake.sort).attr("class","ico-txt");
	}
	if($("#ecmms_zimg_make").attr("alt")=="t"){//图片
	    $("#ecmms_make_img_"+ecmmsmake.sort).attr("src",mDiv.remotehostipport+ecmmsmake.picPath);
	}
	if($("#ecmms_ring_make").html().length>0){//铃声
	    $("#ecmms_make_ring_"+ecmmsmake.sort).attr("class","ico-ring");
	}
	$("#ecmms_make_addbtn").html("<img src='images/addbtn.gif' width='65' height='23' border='0' onClick='fun_ecmms_addone()'>");
	$("#ecmms_make_img"+ecmmsmake.sort).html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_loadOne("+ecmmsmake.sort+")'>"+$("#ecmms_make_img"+ecmmsmake.sort).html()+"</a>");
}


function fun_ecmmsMake_delrefZhenList(){//删除刷新帧列表
    if(ecmmsmake.allsort%ecmmsmake.pagezise==0){
        ecmmsmake.pagecount =ecmmsmake.allsort/ecmmsmake.pagezise;//总页数
        //ecmmsmake.page =ecmmsmake.pagecount;
        $("#ecmmsFrame_zs_make"+(ecmmsmake.allsort+1)).remove();
        $("#ecmmsFrame_zs_make"+(ecmmsmake.allsort+2)).remove();
        $("#ecmmsFrame_zs_make"+(ecmmsmake.allsort+3)).remove();
        $("#ecmmsFrame_zs_make"+(ecmmsmake.allsort+4)).remove();
	    if(ecmmsmake.page>=ecmmsmake.pagecount){
	        $("#ecmmsFrame_zs_make"+(ecmmsmake.allsort-3)).show();
		    $("#ecmmsFrame_zs_make"+(ecmmsmake.allsort-2)).show();
		    $("#ecmmsFrame_zs_make"+(ecmmsmake.allsort-1)).show();
		    $("#ecmmsFrame_zs_make"+ecmmsmake.allsort).show();
		    ecmmsmake.page =ecmmsmake.pagecount;
        }
    }
}

function fun_ecmmsMake_cleardel(zhe) {//删除清空数据区域
	if(zhe==ecmmsmake.allsort+1){
		for(var i=1;i<=ecmmsmake.allsort;i++){//帽新帧标题
			 var h =$("#ecmms_make_tber_"+i).html();
	         h=h.substring(0,h.indexOf("/"));
		     $("#ecmms_make_tber_"+i).html(h+"/"+ecmmsmake.allsort);
		}
	    $("#ecmms_make_del_"+(ecmmsmake.allsort+1)).html("");
	    $("#ecmms_make_del_"+(ecmmsmake.allsort+1)).attr("class","");
		$("#ecmms_make_ms_"+(ecmmsmake.allsort+1)).html("0 秒");//秒数
		$("#ecmms_make_tber_"+(ecmmsmake.allsort+1)).html("");
		$("#ecmms_make_tber_"+(ecmmsmake.allsort+1)).attr("class","");
		$("#ecmms_make_text_"+(ecmmsmake.allsort+1)).attr("class","ico-txt-gray");//帧列表显示灰
		$("#ecmms_make_img_"+(ecmmsmake.allsort+1)).attr("src","images/tmp.jpg");
		$("#ecmms_make_ring_"+(ecmmsmake.allsort+1)).attr("class","ico-ring-gray");
	}else{
		//$("#ecmmsFrame_zs_make"+zhe).remove();//删除帧
		var leg =ecmmsmake.allsort+1;
		for(var i=1;i<=leg;i++){//帧列表向上移动
		     if(i<zhe){
		         var h =$("#ecmms_make_tber_"+i).html();
		         h=h.substring(0,h.indexOf("/"));
			     $("#ecmms_make_tber_"+i).html(h+"/"+ecmmsmake.allsort);
		     }else if(i==zhe){
		         //$("#ecmms_make_del_"+i).remove();
				 $("#ecmms_make_ms_"+i).html("0 秒");//秒数
				 $("#ecmms_make_tber_"+i).html("");
				 $("#ecmms_make_tber_"+i).attr("class","");
				 $("#ecmms_make_text_"+i).attr("class","ico-txt-gray");//帧列表显示灰
				 $("#ecmms_make_img_"+i).attr("src","images/tmp.jpg");
				 $("#ecmms_make_ring_"+i).attr("class","ico-ring-gray");
				 $("#ecmms_make_img"+i).html($("#ecmms_make_img"+i).find("a").html());
		     }else{
				 $("#ecmms_make_ms_"+(i-1)).html($("#ecmms_make_ms_"+i).html());//秒数
				 $("#ecmms_make_text_"+(i-1)).attr("class",$("#ecmms_make_text_"+i).attr("class"));
				 $("#ecmms_make_img_"+(i-1)).attr("class",$("#ecmms_make_img_"+i).attr("class"));
				 $("#ecmms_make_ring_"+(i-1)).attr("class",$("#ecmms_make_ring_"+i).attr("class"));
			     
				 if(mDiv.bwsType=="mozilla"){
				 	 var loadhtml =$("#ecmms_make_img"+i).html();
					 var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
					 newhtml +=(i-1)+')" ';
					 newhtml +=loadhtml.substring(loadhtml.indexOf("><img"),loadhtml.length);
					 var newhtml2= newhtml.substring(0,loadhtml.indexOf("img_")+5);
					 newhtml2 +=(i-1)+'" ';
					 newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
					 $("#ecmms_make_img"+(i-1)).html(newhtml2);
				 }else{
				     var loadhtml =$("#ecmms_make_img"+i).html();
					 var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
					 newhtml +=(i-1)+")  ";
					 newhtml +=loadhtml.substring(loadhtml.indexOf("><IMG"),loadhtml.length);
					 var newhtml2= newhtml.substring(0,newhtml.indexOf("make_img_")+9);
					 newhtml2 +=(i-1)+"  ";
					 newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
					 $("#ecmms_make_img"+(i-1)).html(newhtml2);
				 }
				 $("#ecmms_make_del_"+(i-1)).html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_delOne("+(i-1)+")'>删 除</a>");
				 var h =$("#ecmms_make_tber_"+i).html();
		         h=parseInt(h.substring(0,h.indexOf("/")));
			     $("#ecmms_make_tber_"+(i-1)).html((h-1)+"/"+ecmmsmake.allsort);
	             $("#ecmms_make_tber_"+(i-1)).attr("class","frameNumber");
			     
			     if(i==leg){//清空最后一帧
			         $("#ecmms_make_del_"+i).html("");
			         $("#ecmms_make_del_"+i).attr("class","");
					 $("#ecmms_make_ms_"+i).html("0 秒");//秒数
					 $("#ecmms_make_tber_"+i).html("");
					 $("#ecmms_make_tber_"+i).attr("class","");
					 $("#ecmms_make_text_"+i).attr("class","ico-txt-gray");//帧列表显示灰
					 //$("#ecmms_make_img_"+i).attr("src","images/tmp.jpg");
					 $("#ecmms_make_ring_"+i).attr("class","ico-ring-gray");
					 $("#ecmms_make_img"+i).html("<img id='ecmms_make_img_"+i+"' src='images/tmp.jpg'>");
			     }
		     }
		}
	}
	
    ecmmsmake.mmsallsize = ecmmsmake.mmsallsize-ecmmsMake_sortsize[zhe-1];//修改总帧大小
	$("#ecmms_zsize_make").html("快讯大小： 0KB/ "+ecmmsmake.mmsallsize+"KB ");
	var addbtn =$("#ecmms_make_addbtn").html();
	if(addbtn.indexOf("addbtn.gif")>0){
	    $("#ecmms_make_indexzs").html("当前帧：第 "+(ecmmsmake.allsort+1)+" 帧 时间");
	}

	var sIdlength =ecmmsMake_sortsourceId.length;
	var newsIdarr =new Array();
	for(var i=0;i<sIdlength;i++){
	    if(i!=(zhe-1)){
	        newsIdarr.push(ecmmsMake_sortsourceId[i]);
	    }
	}
	ecmmsMake_sortsourceId =newsIdarr;
	
	var sortlength =ecmmsMake_sortsize.length;
	var newsortarr =new Array();
	for(var i=0;i<sortlength;i++){
	    if(i!=(zhe-1)){
	        newsortarr.push(ecmmsMake_sortsize[i]);
	    }
	}
	ecmmsMake_sortsize =newsortarr;
}

function fun_ecmmsMake_delete(zhe){//删除帧
	divBlockUIOpen('tab_periodical_update','正在删除第'+zhe+'帧...',false,0);
    var count =ecmmsMainObj.periodicalSubArr.length;
	var subObj,zhennum;
	var newarr =new Array();
    for(var i=0;i<count;i++){
        subObj = ecmmsMainObj.getSubObj(i);
        zhennum = subObj.sort;
        if(zhennum!=zhe){
        	if(zhennum>zhe){
        	    subObj.sort=zhennum-1;
        	}
        	newarr.push(subObj);
        }
    }
    ecmmsMainObj.periodicalSubArr =newarr;
    ecmmsmake.allsort--;
    ecmmsmake.sort--;
    fun_ecmmsMake_cleardel(zhe);//清空
    fun_ecmmsMake_delrefZhenList();//删除帧列表页
    fun_ecmmsMake_clearData(ecmmsmake.allsort+1);
    setTimeout(function() {$('#tab_periodical_update').unblock(); }, 1000)
}

function fun_ecmmsMake_delOne(zhe){//删除帧
	 if(ecmmsmake.insert>0){
		alertmsg("当前为插入帧状态 不能删除帧!","alert");
        return;
	 }
	 if(ecmmsmake.update>0){
		alertmsg("当前为修改帧状态 不能删除帧!","alert");
        return;
	 }
     if(parseInt(ecmmsmake.allsort)<2){
		alertmsg("彩信内容至少一帧！","alert");
	 }else{
		confirm("确认要删除 第"+zhe+"帧 吗？", fun_ecmmsMake_delete,zhe);
	 }
}

function fun_ecmmsMake_insert(zhe){
	ecmmsmake.insert =zhe;
//	var zhehtml="";
//    zhehtml="<tr id='ecmmsFrame_zs_make"+zhe+"' class=''><td width='50%' valign='top' class='preview'><div id='ecmms_make_tber_"+zhe+"' class=''></div><div id='ecmms_make_img"+zhe+"' class='imgs'><img id='ecmms_make_img_"+zhe+"' src='images/tmp.jpg'/></div></td>"
//        +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='ecmms_make_ring_"+zhe+"' class='ico-ring-gray'></span></td>"
//        +"<td><span id='ecmms_make_text_"+zhe+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='ecmms_make_ms_"+zhe+"' class='second cl'>0 秒</p><p id='ecmms_make_del_"+zhe+"' class=''></p></a></td></tr>";
//   $(zhehtml).insertBefore("#ecmmsFrame_zs_make"+zhe);
    ecmmsmake.sort =ecmmsmake.allsort+1;
    if(ecmmsmake.sort>ecmmsmake.pagezise&&ecmmsmake.sort%ecmmsmake.pagezise==1){
        ecmmsmake.pagecount++; 
	    $("#ecmmsFrame_zs_make").append(fun_ecmmsMake_tabHml());//添加帧列表数据
	}
    var leg =ecmmsmake.sort;
	for(var i=leg;i>0;i--){//帧列表向下移动
		if(i>zhe){
		    $("#ecmms_make_ms_"+i).html($("#ecmms_make_ms_"+(i-1)).html());//秒数
			$("#ecmms_make_text_"+i).attr("class",$("#ecmms_make_text_"+(i-1)).attr("class"));
			$("#ecmms_make_img_"+i).attr("class",$("#ecmms_make_img_"+(i-1)).attr("class"));
			$("#ecmms_make_ring_"+i).attr("class",$("#ecmms_make_ring_"+(i-1)).attr("class"));

			if(mDiv.bwsType=="mozilla"){
				var loadhtml =$("#ecmms_make_img"+(i-1)).html();
				var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
				newhtml +=i+')" ';
				newhtml +=loadhtml.substring(loadhtml.indexOf("><img"),loadhtml.length);
				var newhtml2= newhtml.substring(0,newhtml.indexOf("_img")+5);
				newhtml2 +=i+'" ';
				newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
				$("#ecmms_make_img"+i).html(newhtml2);
			}else{
				var loadhtml =$("#ecmms_make_img"+(i-1)).html();
				var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
				newhtml +=i+")  ";
				newhtml +=loadhtml.substring(loadhtml.indexOf("><IMG"),loadhtml.length);
				var newhtml2= newhtml.substring(0,newhtml.indexOf("make_img_")+9);
				newhtml2 +=i+"  ";
				newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
				$("#ecmms_make_img"+i).html(newhtml2);
			}
			
			$("#ecmms_make_del_"+i).attr("class","delframe");
			$("#ecmms_make_del_"+i).html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_delOne("+i+")'>删 除</a>"); 	 
		    $("#ecmms_make_tber_"+i).html(i+"/"+leg);
            $("#ecmms_make_tber_"+i).attr("class","frameNumber");
            
            //$("#ecmms_make_del_"+(i-1)).remove();
			$("#ecmms_make_ms_"+(i-1)).html("0 秒");//秒数
			$("#ecmms_make_tber_"+(i-1)).html("");
			$("#ecmms_make_tber_"+(i-1)).attr("class","");
			$("#ecmms_make_text_"+(i-1)).attr("class","ico-txt-gray");//帧列表显示灰
			$("#ecmms_make_ring_"+(i-1)).attr("class","ico-ring-gray");
			$("#ecmms_make_img"+(i-1)).html("<img id='ecmms_make_img_"+(i-1)+"' src='images/tmp.jpg'>");
			
		}else if(i==zhe){
			$("#ecmms_make_tber_"+i).html(zhe+"/"+leg);
            $("#ecmms_make_tber_"+i).attr("class","frameNumber");
            if(zhe>1){
                $("#ecmms_make_del_"+i).attr("class","delframe");
		        $("#ecmms_make_del_"+i).html("<a href='javascript:void(0)' onClick='fun_ecmmsMake_delOne("+zhe+")'>删 除</a>");
            }
			fun_ecmmsMake_clearData(zhe);
			$("#ecmms_insert_zhe").html("<a href='#' class='insertFrame-gray floatr'>插入帧</a>快讯帧列表");
			$("#ecmms_make_addbtn").html("<img src='images/insertbtn.gif' width='65' height='23' border='0' onClick='fun_ecmms_insertone()'>");
	   }else{
		    $("#ecmms_make_tber_"+i).html(i+"/"+leg);
            $("#ecmms_make_tber_"+i).attr("class","frameNumber");
	   }

	    var pages =ecmmsmake.page*ecmmsmake.pagezise;
	    if(i>pages){
	        $("#ecmmsFrame_zs_make"+i).hide();
	        $("#ecmmsFrame_zs_make"+(i+1)).hide();
	        $("#ecmmsFrame_zs_make"+(i+2)).hide();
	        $("#ecmmsFrame_zs_make"+(i+3)).hide();
	    }else if(i<(pages-3)){
	        $("#ecmmsFrame_zs_make"+i).hide();
	        $("#ecmmsFrame_zs_make"+(i-1)).hide();
	        $("#ecmmsFrame_zs_make"+(i-2)).hide();
	        $("#ecmmsFrame_zs_make"+(i-3)).hide();
	    }
	}
    ecmmsmake.sort =zhe;
}
